#!/bin/bash

if [ $# -lt 2 ]
  then
    echo "Usage: $0 outputDirectory nasm"
		exit
fi


mkdir ./objects

cp $1*.s ./objects

for filename in ./objects/*.s; do
	$2 -O1 -f elf -g -F dwarf $filename
done

ld -melf_i386 -o main ./objects/*.o

mv main ./objects

./objects/main

rm -rf ./objects
